/**
 * @type {Number}
 *
 * @properties={typeid:35,uuid:"A9F1E42C-8A0E-4175-BEFC-929BDEEBFA60",variableType:4}
 */
var $historico = 0;

/**
 * @type {Number}
 *
 * @properties={typeid:35,uuid:"586405B8-98D7-43FA-BC65-B12FBD3ECB34",variableType:4}
 */
var $historico_listado_provincias = 1;

/**
 * @type {Number}
 *
 * @properties={typeid:35,uuid:"82AAD1B4-CC46-40BF-828F-1E12D009B503",variableType:4}
 */
var $historico_listado_localidades = 2;

/**
 * Perform the element default action.
 *
 * @param {JSEvent} event the event that triggered the action
 *
 * @properties={typeid:24,uuid:"D600C3F6-78DA-461E-8072-053DD2B55F37"}
 */
function historico_opciones(event) {
	// TODO Auto-generated method stub
}


/**
 * @properties={typeid:24,uuid:"EF131EDB-D59F-4B25-BB61-C93EA0126463"}
 */
function doEdit(){
	
	elements.historicos.enabled = false;
	elements.btn_alta_historicos.enabled = false;
	elements.btn_menu_historicos.enabled = false;
	elements.tab_historicos.enabled = false;
	controller.focusField(elements.fld_s_descripcion.getName(),true);
}

/**
 * @properties={typeid:24,uuid:"CCB4EA7E-F1C9-47F9-8207-2C257B97BE3C"}
 */
function hide_btn_reset_fields(){
	
	elements.historicos.enabled = true;
	elements.btn_alta_historicos.enabled = true;
	elements.btn_menu_historicos.enabled = true;
	elements.tab_historicos.enabled = true;
}

/**
 * Handle changed data.
 *
 * @param {Number} oldValue old value
 * @param {Number} newValue new value
 * @param {JSEvent} event the event that triggered the action
 *
 * @returns {Boolean}
 *
 * @private
 *
 * @properties={typeid:24,uuid:"C3BA568E-B3F5-4C4C-8744-EBDCE508CE31"}
 */
function onDataChangeHistorico(oldValue, newValue, event) {

	elements.tab_historicos.removeAllTabs();
	if ($historico == $historico_listado_provincias){
//		elements.tab_historicos.addTab(forms.lst_adm_t900_perfiles_h,null,null,null,null,null,null, adm_t900_aplicaciones_id);
	}else if  ($historico == $historico_listado_localidades){
//		elements.tab_historicos.addTab(forms.lst_adm_t900_usuarios_h,null,null,null,null,null,null, adm_t900_empresas_to_adm_t900_usuarios);
	}
	return true
}


/**
 * Callback method for when form is shown.
 * @author Roberto J. Blasco
 * @version 1.0
 * @param {Boolean} firstShow form is shown first time after load
 * @param {JSEvent} event the event that triggered the action
 * @private
 * @properties={typeid:24,uuid:"952DE718-4DB4-4528-8D76-0A50A9ED9AFE"}
 */
function onShow(firstShow, event) {

	if (foundset.getSelectedRecord().isNew()){
		elements.tab_historicos.visible = false;
	}else{
		
		var dataset = databaseManager.createEmptyDataSet(0,new Array('display_values','optional_real_values'));
		dataset.addRow(['LISTADO DE PROVINCIAS', $historico_listado_provincias]);
		dataset.addRow(['LISTADO DE LOCALIDADES', $historico_listado_localidades]);
		elements.historicos.setValueListItems(dataset);
		
		elements.tab_historicos.visible = true;
		elements.tab_historicos.removeAllTabs();
		$historico = $historico_listado_provincias;
//		elements.tab_historicos.addTab(forms.lst_adm_t300_apli_emp__emp_h,null,null,null,null,null,null,adm_t900_aplicaciones_to_adm_t300_apli_emp);
	}
}

/**
 * Perform the element default action.
 *
 * @param {JSEvent} event the event that triggered the action
 *
 * @properties={typeid:24,uuid:"591DE38B-C58F-4D38-95FC-A883DFC49FF7"}
 */
function historico_alta(event) {

	if ($historico == $historico_listado_provincias){
//		globals.ir_formulario(event,forms.frm_adm_t900_perfiles.controller.getName(),null,globals.$MODO_ALTA,ds);
	}else if ($historico == $historico_listado_localidades){
//		globals.ir_formulario(event, forms.frm_adm_t900_usuarios.controller.getName(), null,  globals.$MODO_ALTA,ds);
	}
}